package com.ciwong.epaper.modules.me.dao.db.table;

/**
 * 我的学习记录表
 *
 * @author res-qqlin
 * @version ciwong v.2.0 2015/7/29
 * @since ciwong v.2.0
 */
public class StudyRecordTable
{

    /**
     * The unique ID for a row.
     * <P>
     * Type: INTEGER (long)
     * </P>
     */
    public static final String _ID = "_id";

    /**
     * 表名
     */
    public static final String TABLE_NAME = "study_record_table";

    public static final String DO_WORK_ID = "doWorkId";

    public static final String USER_ID = "userId";

    public static final String USER_NAME = "userName";

    public static final String PACKAGE_ID = "packageId";

    public static final String CID = "cld";

    public static final String MODULE_ID = "moduledId";

    public static final String VERSION_ID = "versionId";

    public static final String RESOURCE_NAME = "resourceName";

    public static final String PARENT_VERSION_ID = "parentVersionId";

    public static final String RESOURCE_TYPE = "resourceType";

    public static final String WORK_ID = "workId";

    public static final String ACTUAL_SCORE = "actualScore";

    public static final String WORK_LONG = "workLong";

    public static final String DO_WORK_PACKAGE_URL = "doWorkPackageUrl";

    public static final String DO_WORK_LOCAL_PATH = "doWorkLocalPath";

    public static final String WORK_STATUS = "workStatus";

    public static final String SUBMIT_DATE = "submitDate";

    public static final String SUBMIT_STATUS = "submitStatus";

    public static final String CREATE_TIME = "createTime";

    public static final String WORK_ANSWERS = "workAnswers";

    public static final String CODE_ID = "codeId";

    public static final String COMMENT = "comment";

    public static final String WORK_SCORE = "workScore";

    public static final String CLASS_ID = "classId";

    public static final String OLD_DO_WORK_ID = "oldDoWorkId";// 对应的旧的作业的DoWorkId

    public static final String LOG_INFO = "logInfo";// 错误信息(当无法识别时的具体错误)

    public static final String BRAND_ID = "brandId";

    public static final String CHECKED_RESOURCE = "checkedResource";

    /**
     * 创建表sql
     */
    private static String createSql;

    static
    {
        StringBuffer sb = new StringBuffer();
        sb.append("create table " + TABLE_NAME + " (");
        sb.append(_ID + " integer primary key autoincrement,");
        sb.append(DO_WORK_ID + " varchar(128),");
        sb.append(USER_ID + " long,");
        sb.append(USER_NAME + " varchar(128),");
        sb.append(PACKAGE_ID + " varchar(128),");
        sb.append(CID + " varchar(128),");
        sb.append(MODULE_ID + " integer,");
        sb.append(VERSION_ID + " varchar(128),");
        sb.append(RESOURCE_NAME + " text,");
        sb.append(PARENT_VERSION_ID + " varchar(128),");
        sb.append(RESOURCE_TYPE + " integer,");
        sb.append(WORK_ID + " varchar(128),");
        sb.append(WORK_ANSWERS + " varchar(512),");
        sb.append(ACTUAL_SCORE + " real,");
        sb.append(WORK_LONG + " integer,");
        sb.append(DO_WORK_PACKAGE_URL + " varchar(512),");
        sb.append(DO_WORK_LOCAL_PATH + " varchar(512),");
        sb.append(WORK_STATUS + " integer,");
        sb.append(SUBMIT_DATE + " long,");
        sb.append(SUBMIT_STATUS + " integer,");
        sb.append(CREATE_TIME + " long,");
        sb.append(CODE_ID + " long,");
        sb.append(LOG_INFO + " varchar(512),");
        sb.append(COMMENT + " text,");
        sb.append(WORK_SCORE + " real,");
        sb.append(CLASS_ID + " varchar(128),");
        sb.append(OLD_DO_WORK_ID + " varchar(128),");
        sb.append(BRAND_ID + " integer,");
        sb.append(CHECKED_RESOURCE + " varchar(512))");
        createSql = sb.toString();
        // System.out.println(createSql);
    }

    /**
     * 获取列
     *
     * @return 列
     */
    public static String[] getColumns()
    {
        return new String[]{_ID, DO_WORK_ID, USER_ID, USER_NAME, PACKAGE_ID,
                CID, MODULE_ID, VERSION_ID, RESOURCE_NAME, PARENT_VERSION_ID,
                RESOURCE_TYPE, WORK_ID, WORK_ANSWERS, ACTUAL_SCORE, WORK_LONG,
                DO_WORK_PACKAGE_URL, DO_WORK_LOCAL_PATH, WORK_STATUS,
                SUBMIT_DATE, SUBMIT_STATUS, CREATE_TIME, CODE_ID, LOG_INFO,
                COMMENT, WORK_SCORE, CLASS_ID, OLD_DO_WORK_ID, BRAND_ID,
                CHECKED_RESOURCE};
    }

    public static String getCreateSql()
    {
        return createSql;
    }

    public static void setCreateSql(String createSql)
    {
        StudyRecordTable.createSql = createSql;
    }
}
